﻿using System;

class CheckBrackets
{
    static void Main()
    {

        string expression = "((a+b)/5-d)";
        //string expression = ")(a+b))";
        bool isValid = true;
        int sum = 0;

        for (int i = 0; i < expression.Length; i++)
        {
            if (expression[i]=='(')
            {
                sum++;
            }

            if (expression[i] == ')')
            {
                sum--;
            }

            if (sum<0)
            {
                isValid = false;
                break;
            }
        }

        Console.WriteLine("It is {0} that the statement is correct",isValid);

    }
}
